package com.greensock.easing
{
	/**
	 * BallEase
	 * @author lxh
	 * 
	 */	
	public class BallEase
	{
		public static var sa :Number = 0.002;
		public static var sb :Number = -1;
		public static var sc :Number = 50;
		/**
		 *2次方程 
		 * @param t
		 * @param b
		 * @param c
		 * @param d
		 * @return 
		 */		
		public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number 
		{
			var radio :Number = 0;
			if(t==d) 
			{
				radio = b + c;
			}
			else
			{
				radio = (sa * Math.pow(t/0.04,3)/3 + sb * Math.pow(t/0.04,2)/2 + sc * t/0.04)/(sa * Math.pow(d/0.04,3)/3 + sb * Math.pow(d/0.04,2)/2 + sc * d/0.04);
			}
			//trace("BallEase.easeOut: ","t = ",t,",radio = ",radio);
			return radio;
		}
		/**
		 * 指数方程
		 * @param t
		 * @param b
		 * @param c
		 * @param d
		 * @return 
		 * 
		 */		
		//private static var temp :Number = 0;
		public static function easeOut_a(t:Number, b:Number, c:Number, d:Number):Number
		{
			var radio :Number = 0;
			if(t==d) 
			{
				radio = b + c;
			}
			else
			{
				radio = (Math.pow(0.98,t/0.02) - 1)/(Math.pow(0.98,d/0.02) - 1);
			}
			//trace("BallEase.easeOut: ","t = ",t,",radio = ",radio - temp);
			//temp = radio;
			return radio;
		}
	}
}